package com.adxon.servlet;

import com.adxon.cookie.Station;
import com.adxon.data.Item;
import com.adxon.data.ItemSet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class AllServlet extends ServletBase{
	public void doGet(HttpServletRequest req,HttpServletResponse resp)
			throws IOException,ServletException{
		String r=req.getPathInfo();
		System.out.println("AllServlet: "+r);
		Item u=Station.getCurrentUser(req);
		Item s=new Item();
		s.setStarer(u);
		s.setRate(9);
		if(r==null || r.length()<2){
			setAttributes(req,null);
		}else if(r.charAt(1)=='*'){
			String g=r.substring(2);
			setAttributes(req,g);
			s.setTags(g);
			req.setAttribute("g",g);
		}else forward404(req,resp);
		req.setAttribute("m",new ItemSet(s,null));
		req.setAttribute("b","all");
		forward("list.jsp",req,resp);
	}
}